package com.zengqingfa.examples.mybatisplus.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ProcessTypeEnum {
    CREATE_WAREHOUSE(1, "aa创建审批"), UPDATE_WAREHOUSE(2, "bb变更申请"), DELETE_WAREHOUSE(3, "cc仓库申请"), OVERSOLD_ADJUST(4,
            "dd调整");
    private final Integer key;
    private final String desc;

    ProcessTypeEnum(int key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public static ProcessTypeEnum getEnum(Integer key) {
        ProcessTypeEnum[] processTypeEnums = values();
        for (ProcessTypeEnum processTypeEnum : processTypeEnums) {
            if (processTypeEnum.getKey().equals(key)) {
                return processTypeEnum;
            }
        }
        return null;
    }
}
